package home.projects.misc;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ScrapRegexTests {

    public static void main(final String[] args) {
        String hitInput = "[CHAT WINDOW TEXT] [Sun Nov 29 11:34:13] Guardian of Water attacks Kyton's Rebuke [BH] : *hit* : (20 + 108 = 128 : Threat Roll: 3 + 108 = 111)";
        String hitRegex = "^.*\\]\\s+(.+)\\s+attacks\\s+(.+)\\s+:\\s\\*([a-z][a-z]+)\\*\\s+:\\s.*\\+\\s(\\d+)\\s.+\\s+:\\s(.*)";
        
        Pattern pat = Pattern.compile(hitRegex);
        Matcher matcher = pat.matcher(hitInput);
        if(matcher.matches()) {
            System.out.println("Regex matched  : #" + matcher.group(1) + "#");
            System.out.println("Regex matched  : #" + matcher.group(2) + "#");
            System.out.println("Regex matched  : #" + matcher.group(3) + "#");
            System.out.println("Regex matched  : #" + matcher.group(4) + "#");
            System.out.println("Unprocessed String  : #" + matcher.group(5) + "#");
        } else {
            System.out.println("No match found!");
        }
    }

}
